﻿@namespace SwashbucklerDiary.Components
@inherits CardListComponentBase<DiaryModel>

<div class="card-list-wrap">
    <div class="card-list-main">
        <CascadingValue Value="this"
                        IsFixed="true">
            <Virtualize Items="Value"
                        ItemSize="150"
                        Context="item">
                <DiaryCard @key="item.Id"
                           Value="item">
                </DiaryCard>
            </Virtualize>
        </CascadingValue>
    </div>
    @if (Value.Any())
    {
        <MultiDisplay Tablet="true">
            <DesktopContent>
                <div class="card-list-assist-info">
                    <DiaryStatisticsCard Diaries="Value"></DiaryStatisticsCard>
                </div>
            </DesktopContent>
        </MultiDisplay>
    }
</div>

<EmptyContent Show="!Value.Any()"
              Text="@(NotFoundText ?? I18n.T("Diary.NoDiary"))">
</EmptyContent>

<SelectTags @bind-Value="ShowSelectTag"
            @bind-Values="SelectedTags"
            Tags="Tags"
            TagsChanged="TagsChanged"
            OnSave="SaveSelectTags">
</SelectTags>

<DeleteDialog @bind-Value="ShowDeleteDiary"
              Title="@(I18n.T("Diary.Delete.Title"))"
              Content="@(I18n.T("Diary.Delete.Content"))"
              OnOK="ConfirmDelete">
</DeleteDialog>

<ExportDialog @bind-Value="ShowExport"
              Diaries="ExportDiaries">
</ExportDialog>

<RadioDialog @bind-ItemValue="SortItem"
             Value="ShowSort"
             ValueChanged="ShowSortChanged"
             Title="@(I18n.T("Share.Sort"))"
             TItemValue="string"
             Items="SortItems">
</RadioDialog>